<!DOCTYPE html>
<html lang="zh-cn">
<head>
    {include file="part/load.phtml"}
</head>

<body>

<!-- **********************************************************************************************************************************************************
MAIN CONTENT
*********************************************************************************************************************************************************** -->

<div id="login-page">
    <div class="container">

        <div class="form-login">
            <h2 class="form-login-heading"><b>华电外卖后台管理</b></h2>

            <div class="login-wrap">
                <input id="userName" type="text" class="form-control" placeholder="用户名" autofocus>
                <br>
                <input id="userPwd" type="password" class="form-control" placeholder="密码">
                <label class="checkbox">
		                <span class="pull-right">
		                    <a href="javascript:gDialog.fTip('忘记密码 ?', '请联系管理员人工处理')"> 忘记密码？</a>
		
		                </span>
                </label>
                <button class="btn btn-theme btn-block" onclick="javascript:login()"><i class="fa fa-lock"></i>
                    登 录
                </button>
                <hr>

                <div class="login-social-link centered">
                    <!--                    <p>or you can sign in via your social network</p>-->
                    <!--                    <button class="btn btn-facebook" type="submit"><i class="fa fa-facebook"></i> Facebook</button>-->
                    <!--                    <button class="btn btn-twitter" type="submit"><i class="fa fa-twitter"></i> Twitter</button>-->
                </div>
                <div class="registration">
                    Copyright ©2017 华北电力大学后勤集团
                </div>

            </div>

        </div>

    </div>
</div>

{include file="part/footer.phtml"}
<!--BACKSTRETCH-->
<!-- You can use an image of whatever size. This script will stretch to fit in any screen size.-->
<script type="text/javascript" src="/assets/js/jquery.backstretch.min.js"></script>
<script>
    $.backstretch("/assets/img/login-bg.jpg", {speed: 500});
    function login(){
        var user = {
            user_name:$('#userName').val(),
            user_pwd:$('#userPwd').val()
        };
        console.log(user);
        if(!user.user_name){
            gDialog.fTip('登录', '请输入用户名！');
        } else if(!user.user_pwd){
            gDialog.fTip('登录', '请输入密码！');
        } else{
            $.ajax({
                type: 'POST',
                url: '/user/apis/login',
                data: {
                    user: user
                },
                success: function (res) {
                    console.log(res);
                    if (res > 0) {
                        gDialog.fTip('登录', '登录成功！', function () {
                            location.href = '/order?app=1';
                        });
                    } else {
                        gDialog.fTip('登录', '登录失败！');
                    }
                },
                fail: function (res) {
                    console.log(res);
                }
            });

        }
    }
</script>


</body>
</html>
